Developer Documentation

QuickTime 4 API Documentation

QuickTime 4 Reference

| Previous | Chapter Contents | Chapter Top | Next |

Generating Tween Media Values

Your tween component must process kTweenerDoTweenSelect requests from the Component Manager. Listing 22 shows a function, TweenDoTween, for processing this request. It takes short-integer values and performs the necessary interpolation.

Listing 22 Function that generates tween media values

pascal ComponentResult TweenDoTween (
                                         TweenerComponent tc,
                                         TweenRecord *tr)
{
    short       *data;
    short       tFrom, tTo, tValue;

    QTGetAtomDataPtr(tr->container, tr->dataAtom, nil, (Ptr *)&data);

    tFrom = data[0];
    tTo = data[1];
    tValue = tFrom + FixMul(tTo - tFrom, tr->percent);

    (tr->dataProc)((struct TweenRecord *)tr, &tValue,
        sizeof(tValue), 1, nil, nil, nil, nil);

    return noErr;
}

© 1999 Apple Computer, Inc.

| Previous | Chapter Contents | Chapter Top | Next |